
# 对登录页面进行封装
class LoginPage:

    def __init__(self, driver):
        self.driver = driver

    # 1.点击首页的“登录"链接，进入登录页面
    def click_login_link(self):
        return self.driver.find_element_by_class_name('red').click()

    # 2.输入一个不存在的用户名
    def input_username(self, username):
        return self.driver.find_element_by_id('username').send_keys(username)

    # 3.输入密码
    def input_password(self, password):
        return self.driver.find_element_by_id('password').send_keys(password)

    # 4.输入验证码
    def input_verify_code(self, code):
        return self.driver.find_element_by_id('verify_code').send_keys(code)

    # 5.点击登录按钮
    def click_login_btn(self):
        return self.driver.find_element_by_name('sbtbutton').click()

    # 6.获取错误提示信息
    def get_msg(self):
        msg = self.driver.find_element_by_css_selector('.layui-layer-content').text
        return msg













